﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using SimpleQueryTool.Library.Business;

namespace SimpleQueryTool.Library
{
	[TestClass]
	public class QueryManagerTest
	{
		private QueryManager _object;
		private ConnectionDetail _connection;

		[TestInitialize]
		public void Initialize()
		{
			_object = new QueryManager();

			_connection = new ConnectionDetail();
			_connection.Name = "MyTestConnection";
			_connection.Providername = "System.Data.SqlServerCe.3.5";
			_connection.ConnectionString = @"Data Source=C:\Codeplex\SimpleQueryTool\Branches\Main\SimpleQueryTool.IntegrationTests\Database\TestDB.sdf;Password=whatever;Persist Security Info=False;";
		}
		
		[TestMethod]
		public void ExecuteSql_must_execute_without_any_exception()
		{
			var result = _object.ExecuteSql(_connection, "select * from customer");

			Assert.IsTrue(result.Rows.Count == 0);
		}
	}
}
